package com.dhwl.hsh.lib.api;

import com.dhwl.hsh.lib.bean.HttpResponse;
import com.dhwl.hsh.lib.bean.resp.MerchantResp;
import com.dhwl.hsh.lib.bean.resp.UserAuthResp;
import com.dhwl.hsh.lib.bean.resp.UserResponse;

import retrofit2.http.Field;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import rx.Observable;

/**
 * 用户相关接口
 *
 * @author Derek.Kidd
 * @version V1.0.0
 * @date 2016-04-18 17:47
 */
public interface UserApi {
    /**
     * 商户用户登录
     *
     * @param account
     * @param pwd
     * @return
     */
//    @FormUrlEncoded
    @POST("merchantAction/appMerchantLogin")
    Observable<HttpResponse<UserResponse>> merchantLogin(@Query("userName") String account, @Query("passStr") String pwd);

    /**
     * 司机用户登录
     *
     * @param account
     * @param pwd
     * @return
     */
    @POST("user/driverLogin")
    Observable<HttpResponse<UserResponse>> driverLogin(@Field("userName") String account, @Field("passStr") String pwd);

    /**
     * 商户详情信息
     *
     * @return
     */
    @GET("merchantAction/merchant")
    Observable<HttpResponse<MerchantResp>> getMerchant();

    /**
     * 司机详情信息
     *
     * @return
     */
    @GET("user/driver")
    Observable<HttpResponse<UserResponse>> getDriver();

    /**
     * 获取商户或司机认证信息
     *
     * @return
     */
    @GET("userAction/authen")
    Observable<HttpResponse<UserAuthResp>> getUserAuth();

    /**
     * 修改密码
     * @param oldPwd
     * @param newPwd
     * @return
     */
    @POST("userAction/password")
    Observable<HttpResponse<String>> fixPwd(@Query("oldPassword") String oldPwd, @Query("newPassword") String newPwd);

    /**
     * 重置密码（忘记密码）
     * @param phone
     * @param newPwd
     * @param checkNum
     * @return
     */
    @PUT("userAction/password")
    Observable<HttpResponse<String>> resetPwd(@Field("phone")String phone,@Field("password")String newPwd,@Field("checkNum")String checkNum);


}
